//
//  FileBrowserAppDelegate.m
//  FileBrowser
//
//  Created by Basuke on 08/03/16.
//  Copyright Basuke's 2008. All rights reserved.
//

#import "FileBrowserAppDelegate.h"
#import "FileSystemController.h"

@implementation FileBrowserAppDelegate

- (UIViewController *)createViewController {
	// Set up table view
    FileSystemController *fsController = [[[FileSystemController alloc] init] autorelease];
	
	UINavigationController *nav = [[[UINavigationController alloc] initWithRootViewController:fsController] autorelease];
	fsController.navigation = nav;
	return nav;
}

- (void)windowWillDisplay {
	const NSString *key = @"LAUNCH COUNT";
	
	NSNumber *value = [self.session objectForKey:key];
	NSUInteger counter = 0;
	
	if (value) {
		counter = [value intValue];
		NSLog(@"this is %dth launch", counter);
	} else {
		NSLog(@"first visit. welcome");
	}
	
	[self.session setObject:[NSNumber numberWithInt:++counter] forKey:key];
	
}

@end
